#include <iostream>
#include <iterator>
#include <vector>
#include <list>
#include <set>
#include <algorithm>

using std::cout;
using std::endl;
using std::ostream_iterator;
using std::back_inserter;
using std::back_insert_iterator;
using std::front_inserter;
using std::front_insert_iterator;
using std::inserter;
using std::insert_iterator;
using std::vector;
using std::list;
using std::set;
using std::copy;

void test0(){
    vector<int> vec = {1,4,3,9,5,6,2};
    list<int> lst = {0,11,44,22,88,55};

    /* copy(lst.begin(),lst.end(),back_inserter(vec)); */
    copy(lst.begin(),lst.end(),back_insert_iterator<vector<int>>(vec));
    copy(vec.begin(),vec.end(),ostream_iterator<int>(cout," "));
    cout << endl;
    
    cout << endl;
    set<int> se = {1,33,4,8,3,2,6};
    auto it = se.begin();
    copy(lst.begin(),lst.end(),inserter(se,it));
    copy(se.begin(),se.end(),ostream_iterator<int>(cout," "));
    cout << endl;
}

int main(int argc, char * argv[])
{
    test0();
    return 0;
}


